﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Infratructure.Migrations
{
    /// <inheritdoc />
    public partial class xkngwxl : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Adcode",
                table: "gaoDeWeatherModels");

            migrationBuilder.DropColumn(
                name: "City",
                table: "gaoDeWeatherModels");

            migrationBuilder.DropColumn(
                name: "Extensions",
                table: "gaoDeWeatherModels");

            migrationBuilder.DropColumn(
                name: "Output",
                table: "gaoDeWeatherModels");

            migrationBuilder.DropColumn(
                name: "ReportTime",
                table: "gaoDeWeatherModels");

            migrationBuilder.DropColumn(
                name: "CreateTime",
                table: "GaoDeWeatherCast");

            migrationBuilder.DropColumn(
                name: "CreaterPeople",
                table: "GaoDeWeatherCast");

            migrationBuilder.DropColumn(
                name: "GaoDeWeatherId",
                table: "GaoDeWeatherCast");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "GaoDeWeatherCast");

            migrationBuilder.DropColumn(
                name: "IsDel",
                table: "GaoDeWeatherCast");

            migrationBuilder.DropColumn(
                name: "UpdateTime",
                table: "GaoDeWeatherCast");

            migrationBuilder.RenameTable(
                name: "GaoDeWeatherCast",
                newName: "gaoDeWeatherCasts");

            migrationBuilder.RenameColumn(
                name: "Province",
                table: "gaoDeWeatherModels",
                newName: "Count");

            migrationBuilder.CreateTable(
                name: "ApprovalAssigneeModel",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    nodeId = table.Column<long>(type: "bigint", nullable: false),
                    assignee = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    assigneeType = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ApprovalAssigneeModel", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ApprovalNodeModel",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    processId = table.Column<long>(type: "bigint", nullable: false),
                    nodeName = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    nodeType = table.Column<int>(type: "int", nullable: false),
                    prevnodeId = table.Column<long>(type: "bigint", nullable: true),
                    nextnodeId = table.Column<long>(type: "bigint", nullable: true),
                    nodeDescription = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    timeLimit = table.Column<int>(type: "int", nullable: true),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ApprovalNodeModel", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ApprovalNotificationModel",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    receiver = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    title = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    content = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    type = table.Column<int>(type: "int", nullable: false),
                    sentTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    IsSuccess = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    flowId = table.Column<long>(type: "bigint", nullable: false),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ApprovalNotificationModel", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "approvalProcessInstanceModel",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    processId = table.Column<long>(type: "bigint", nullable: false),
                    currentNodeId = table.Column<long>(type: "bigint", nullable: false),
                    productionOrder = table.Column<long>(type: "bigint", nullable: false),
                    initiator = table.Column<long>(type: "bigint", nullable: false),
                    status = table.Column<int>(type: "int", nullable: false),
                    starttiome = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    endtime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_approvalProcessInstanceModel", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ApprovalProcessModel",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    processName = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    status = table.Column<int>(type: "int", nullable: false),
                    startNodeId = table.Column<long>(type: "bigint", nullable: true),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    CreaterPeople = table.Column<string>(type: "varchar(15)", maxLength: 15, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    UpdaterPeople = table.Column<string>(type: "varchar(15)", maxLength: 15, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ApprovalProcessModel", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ApprovaltaskModel",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    errandInstanceid = table.Column<long>(type: "bigint", nullable: false),
                    nodeId = table.Column<long>(type: "bigint", nullable: true),
                    assigneeId = table.Column<long>(type: "bigint", nullable: false),
                    taskstatus = table.Column<int>(type: "int", nullable: false),
                    createtime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    duetime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    IsDel = table.Column<bool>(type: "tinyint(1)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ApprovaltaskModel", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "gaoDeWeatherForecasts",
                columns: table => new
                {
                    City = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Adcode = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Province = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReportTime = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "gaoDeWeatherLives",
                columns: table => new
                {
                    Province = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    City = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Adcode = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Weather = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Temperature = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WindDirection = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WindPower = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Humidity = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReportTime = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "ApprovalTaskHistModel",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    approver = table.Column<long>(type: "bigint", nullable: false),
                    action = table.Column<int>(type: "int", nullable: false),
                    comment = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    handletime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ApprovalTaskHistModel", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ApprovalTaskHistModel_ApprovaltaskModel_Id",
                        column: x => x.Id,
                        principalTable: "ApprovaltaskModel",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ApprovalAssigneeModel");

            migrationBuilder.DropTable(
                name: "ApprovalNodeModel");

            migrationBuilder.DropTable(
                name: "ApprovalNotificationModel");

            migrationBuilder.DropTable(
                name: "approvalProcessInstanceModel");

            migrationBuilder.DropTable(
                name: "ApprovalProcessModel");

            migrationBuilder.DropTable(
                name: "ApprovalTaskHistModel");

            migrationBuilder.DropTable(
                name: "gaoDeWeatherForecasts");

            migrationBuilder.DropTable(
                name: "gaoDeWeatherLives");

            migrationBuilder.DropTable(
                name: "ApprovaltaskModel");

            migrationBuilder.RenameTable(
                name: "gaoDeWeatherCasts",
                newName: "GaoDeWeatherCast");

            migrationBuilder.RenameColumn(
                name: "Count",
                table: "gaoDeWeatherModels",
                newName: "Province");

            migrationBuilder.AddColumn<string>(
                name: "Adcode",
                table: "gaoDeWeatherModels",
                type: "longtext",
                nullable: false)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "City",
                table: "gaoDeWeatherModels",
                type: "longtext",
                nullable: false)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Extensions",
                table: "gaoDeWeatherModels",
                type: "longtext",
                nullable: false)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Output",
                table: "gaoDeWeatherModels",
                type: "longtext",
                nullable: false)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "ReportTime",
                table: "gaoDeWeatherModels",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "CreateTime",
                table: "GaoDeWeatherCast",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "CreaterPeople",
                table: "GaoDeWeatherCast",
                type: "longtext",
                nullable: false)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<long>(
                name: "GaoDeWeatherId",
                table: "GaoDeWeatherCast",
                type: "bigint",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AddColumn<long>(
                name: "Id",
                table: "GaoDeWeatherCast",
                type: "bigint",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AddColumn<bool>(
                name: "IsDel",
                table: "GaoDeWeatherCast",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<DateTime>(
                name: "UpdateTime",
                table: "GaoDeWeatherCast",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
        }
    }
}
